package to;

import java.util.ArrayList;

import javax.xml.bind.annotation.XmlRootElement;

@XmlRootElement(name="order")
public class OrderTO {
	private int orderId;
	private int orderAmount;
	private String typeId;
	private String typeName;
	private int size;
	private String colorId;
	private String colorName;
	int countButtons;
	private ArrayList<ProductTO> productList;
	
	public OrderTO(){
		productList = new ArrayList();
	}

	public OrderTO(String typeId, int size) {
		super();
		this.typeId = typeId;
		this.size = size;
	}

	public OrderTO(int orderId, int orderAmount, String typeId, int size,
			String colorId, int countButtons) {
		super();
		this.orderId = orderId;
		this.orderAmount = orderAmount;
		this.typeId = typeId;
		this.size = size;
		this.colorId = colorId;
		this.countButtons = countButtons;
	}



	public OrderTO(int orderId, int orderAmount, String typeId,
			String typeName, int size, String colorId, String colorName,
			int countButtons) {
		super();
		this.orderId = orderId;
		this.orderAmount = orderAmount;
		this.typeId = typeId;
		this.typeName = typeName;
		this.size = size;
		this.colorId = colorId;
		this.colorName = colorName;
		this.countButtons = countButtons;
	}

	public int getOrderAmount() {
		return orderAmount;
	}

	public void setOrderAmount(int orderAmount) {
		this.orderAmount = orderAmount;
	}

	public ArrayList<ProductTO> getProductList() {
		return productList;
	}

	public void setProductList(ArrayList<ProductTO> productList) {
		this.productList = productList;
	}

	public int getOrderId() {
		return orderId;
	}

	public void setOrderId(int orderId) {
		this.orderId = orderId;
	}

	public String getTypeId() {
		return typeId;
	}

	public void setTypeId(String typeId) {
		this.typeId = typeId;
	}

	public String getTypeName() {
		return typeName;
	}

	public void setTypeName(String typeName) {
		this.typeName = typeName;
	}

	public int getSize() {
		return size;
	}

	public void setSize(int size) {
		this.size = size;
	}

	public String getColorId() {
		return colorId;
	}

	public void setColorId(String colorId) {
		this.colorId = colorId;
	}

	public String getColorName() {
		return colorName;
	}

	public void setColorName(String colorName) {
		this.colorName = colorName;
	}

	public int getCountButtons() {
		return countButtons;
	}

	public void setCountButtons(int countButtons) {
		this.countButtons = countButtons;
	}


	@Override
	public String toString() {
		return "OrderTO [ orderId=" + orderId
				+ ", orderAmount=" + orderAmount + ", typeId=" + typeId
				+ ", typeName=" + typeName + ", size=" + size + ", colorId="
				+ colorId + ", colorName=" + colorName + ", countButtons="
				+ countButtons + "]";
	}


	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((colorId == null) ? 0 : colorId.hashCode());
		result = prime * result
				+ ((colorName == null) ? 0 : colorName.hashCode());
		result = prime * result + countButtons;
		result = prime * result + orderAmount;
		result = prime * result + orderId;
		result = prime * result + size;
		result = prime * result + ((typeId == null) ? 0 : typeId.hashCode());
		result = prime * result
				+ ((typeName == null) ? 0 : typeName.hashCode());
		return result;
	}


	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		OrderTO other = (OrderTO) obj;
		if (colorId == null) {
			if (other.colorId != null)
				return false;
		} else if (!colorId.equals(other.colorId))
			return false;
		if (colorName == null) {
			if (other.colorName != null)
				return false;
		} else if (!colorName.equals(other.colorName))
			return false;
		if (countButtons != other.countButtons)
			return false;
		if (orderAmount != other.orderAmount)
			return false;
		if (orderId != other.orderId)
			return false;
		if (size != other.size)
			return false;
		if (typeId == null) {
			if (other.typeId != null)
				return false;
		} else if (!typeId.equals(other.typeId))
			return false;
		if (typeName == null) {
			if (other.typeName != null)
				return false;
		} else if (!typeName.equals(other.typeName))
			return false;
		return true;
	}

}

